import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:note/widgets/markdown.dart';

class MarkDownView extends StatelessWidget {
  final String path;

  const MarkDownView({super.key, required this.path});

  @override
  Widget build(BuildContext context) {
    return FutureBuilder(
      future: rootBundle.loadString(path),
      builder: (BuildContext context, AsyncSnapshot snapshot) {
        if (snapshot.hasData) {
          return MyMarkDown(data: snapshot.data);
        } else {
          return const Center(
            child: Text("加载中..."),
          );
        }
      },
    );
  }
}
